import Vue from "vue";
import Vuex from "vuex";
import component from "./modules/component";
import menu from "./modules/contextMenu";
import editor from "./modules/editor";
Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    curComponent: null,
    curComponentIndex: null,
    isClickComponent: false,
    isInEdiotr: false,
    isClickComponent: false
  },
  modules: {
    component,
    menu,
    editor,
  },
  mutations: {
    
    setCurComponent(state, { component, index }) {
      state.curComponent = component;
      state.curComponentIndex = index;
    },
    /**
     * 设置编辑状态
     */
    setInEditorStatus(state, status) {
      state.isInEdiotr = status
    },
    /**
     * 设置组件点击状态
     */
    setClickComponentStatus(state, status) {
      state.isClickComponent = status
    },
  },
});
